﻿Namespace Messaging
    Public Class MessageTopicCollection
        'Credit for the original C# version goes to Team MediaPortal
        Private ReadOnly Topics As Dictionary(Of String, MessageTopic) = New Dictionary(Of String, MessageTopic)
        Default Friend ReadOnly Property Item(ByVal Id As String) As MessageTopic
            Get
                Dim Topic As MessageTopic
                If Not Contains(Id) Then
                    Topic = New MessageTopic(Id)
                    Topics.Add(Id, Topic)
                Else
                    Topic = Topics(Id)
                End If
                Return Topic
            End Get
        End Property
        Friend Function Contains(ByVal ID As String) As Boolean
            Return Topics.ContainsKey(ID)
        End Function
    End Class
End Namespace